package exp09dfsbfs;

public class Permutation1 {
    public static void main(String[] args) {
        //O(n^n)=>O(n!)
        for (int a = 0; a < 4; a++)
            for (int b = 0; b < 4; b++) {
                if (b == a) continue;//剪枝
                for (int c = 0; c < 4; c++) {
                    if (c == a || c == b) continue;
                    for (int d = 0; d < 4; d++) {
                        if (d == a || d == b || d == c) continue;
                        System.out.println(String.format("%d %d %d %d", a, b, c, d));
                    }
                }
            }
    }
}
